export function useConfig() {
  const queryParams = ref<Recordable>({})

  const { allRegionOptions } = useRegions()
  const tableColumns = computed(() => {
    return buildColumns([
      {
        title: '应用',
        dataIndex: 'name',
        slotName: 'name',
      },
      {
        title: '可用区域',
        dataIndex: 'regions',
        slotName: 'regions',
        render({ record }) {
          return (
            allRegionOptions.value
              .filter(item => record.region_ids?.includes(item.value))
              .map(item => item?.label)
              ?.join(',') || '-'
          )
        },
      },
      {
        title: '备注',
        dataIndex: 'remark',
        slotName: 'remark',
      },
      // {
      //   title: '状态',
      //   dataIndex: 'status',
      //   slotName: 'status',
      //   width: 130,
      // },
      {
        title: '操作',
        dataIndex: 'action',
        width: 100,
        slotName: 'action',
      },
    ])
  })
  return { queryParams, tableColumns }
}
